package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopUserOrderItemMapper;
import com.ruoyi.shop.domain.ShopUserOrderItem;
import com.ruoyi.shop.service.IShopUserOrderItemService;
import com.ruoyi.common.core.text.Convert;

/**
 * 订单明细Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2021-09-14
 */
@Service
public class ShopUserOrderItemServiceImpl implements IShopUserOrderItemService 
{
    @Autowired
    private ShopUserOrderItemMapper shopUserOrderItemMapper;

    /**
     * 查询订单明细
     * 
     * @param id 订单明细主键
     * @return 订单明细
     */
    @Override
    public ShopUserOrderItem selectShopUserOrderItemById(Long id)
    {
        return shopUserOrderItemMapper.selectShopUserOrderItemById(id);
    }

    /**
     * 查询订单明细列表
     * 
     * @param shopUserOrderItem 订单明细
     * @return 订单明细
     */
    @Override
    public List<ShopUserOrderItem> selectShopUserOrderItemList(ShopUserOrderItem shopUserOrderItem)
    {
        return shopUserOrderItemMapper.selectShopUserOrderItemList(shopUserOrderItem);
    }

    /**
     * 新增订单明细
     * 
     * @param shopUserOrderItem 订单明细
     * @return 结果
     */
    @Override
    public int insertShopUserOrderItem(ShopUserOrderItem shopUserOrderItem)
    {
        shopUserOrderItem.setCreateTime(DateUtils.getNowDate());
        return shopUserOrderItemMapper.insertShopUserOrderItem(shopUserOrderItem);
    }

    /**
     * 修改订单明细
     * 
     * @param shopUserOrderItem 订单明细
     * @return 结果
     */
    @Override
    public int updateShopUserOrderItem(ShopUserOrderItem shopUserOrderItem)
    {
        shopUserOrderItem.setUpdateTime(DateUtils.getNowDate());
        return shopUserOrderItemMapper.updateShopUserOrderItem(shopUserOrderItem);
    }

    /**
     * 批量删除订单明细
     * 
     * @param ids 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteShopUserOrderItemByIds(String ids)
    {
        return shopUserOrderItemMapper.deleteShopUserOrderItemByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除订单明细信息
     * 
     * @param id 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteShopUserOrderItemById(Long id)
    {
        return shopUserOrderItemMapper.deleteShopUserOrderItemById(id);
    }

    /**
     * 根据orderId 查询订单明细
     * @param orderId
     * @return
     */
    @Override
    public List<ShopUserOrderItem> selectShopUserOrderItemByOrderId(Long orderId){
        return shopUserOrderItemMapper.selectShopUserOrderItemByOrderId(orderId);
    }
}
